package com.alks.function.controller.finance.costcheck;

import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.WebLogger;
import com.alks.entity.data.entity.PcMtlPreOther2;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.data.dto.PcMtlPreCheckReq;
import com.alks.function.service.impl.finance.ryfinance.RecTbAccountServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @author:hxl
 * @create: 2024-06-17 17:38
 * @Description: 研发收获检核
 */
@ApiRestController("/mtlPreCheck")
@Api(tags = "研发收获检核")
public class PcMtlPreCheckController {
    @Autowired
    private RecTbAccountServiceImpl service;

    //入库明细查询
    @PostMapping("/pcMltPreCDList")
    @WebLogger
    @ApiOperation(value = "入库明细查询")
    public ResponseInfo pcMltPreCDList(@RequestBody PcMtlPreCheckReq req) {
        return service.pcMltPreCDList(req);
    }

    //打勾记录检核
    @PostMapping("/optionMtlPreCheck")
    @WebLogger
    @ApiOperation(value = "打勾记录检核、取消检核")
    public ResponseInfo optionMtlPreCheck(@RequestBody List<PcMtlPreOther2> list, @RequestParam @ApiParam(value = "1:检核 2：取消检核") String choose) {
        return service.optionMtlPreCheck(list, choose);
    }

    @PostMapping("/insertPriceWS")
    @WebLogger
    @ApiOperation(value = "填充单价、填充送货日期和数量、保存")
    public ResponseInfo insertPriceWS(@RequestBody List<PcMtlPreOther2> list,
                                      @RequestParam(required = false) @ApiParam(value = "折扣") BigDecimal discount,
                                      @RequestParam(required = false) @ApiParam(value = "原单价") BigDecimal orgPrice,
                                      @RequestParam(required = false) @DateTimeFormat(pattern="yyyy-MM-dd") @ApiParam(value = "送货日期") Date sendDate,
                                      @RequestParam @ApiParam(value = "1:填充单价，2：填充送货日期和数量，3：保存") String choose){
        return service.insertPriceWS(list,discount,orgPrice,sendDate,choose);
    }
    @GetMapping("/getPurType")
    @WebLogger
    @ApiOperation(value = "类型")
    public ResponseInfo getPurType(){
        return service.getPurType();
    }
}
